package com.heshuo.basic.service.impl;

import java.io.Serializable;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.transaction.annotation.Transactional;

import com.heshuo.basic.dao.IBaseDAO;
import com.heshuo.basic.page.PageUtil;
import com.heshuo.basic.service.IBaseService;

@Transactional
public class BaseServiceImpl implements IBaseService{
	@Resource(name="ibaseDao")
	private IBaseDAO ibaseDao;

	public IBaseDAO getIbaseDao() {
		return ibaseDao;
	}

	public void setIbaseDao(IBaseDAO ibaseDao) {
		this.ibaseDao = ibaseDao;
	}
	public int count(String hql) throws Exception {
		return ibaseDao.count(hql);
	}

	public void delete(Object o) throws Exception {
		ibaseDao.delete(o);
	}

	public void delete(Serializable key) throws Exception {
		ibaseDao.delete(key);
	}

	@Transactional(noRollbackForClassName = "java.lang.Throwable")
	public List findByPage(String queryString, PageUtil pageUtil) throws Exception {
		return ibaseDao.findByPage(queryString, pageUtil);
	}
	@Transactional(noRollbackForClassName = "java.lang.Throwable")
	public List findByPage(String queryString) throws Exception {
		return ibaseDao.findByPage(queryString);
	}
	@Transactional(noRollbackForClassName = "java.lang.Throwable")
	public List findByProperty(String propertyName, Object value)
			throws Exception {
		// TODO Auto-generated method stub
		return ibaseDao.findByProperty(propertyName, value);
	}

	

	@Transactional(noRollbackForClassName = "java.lang.Throwable")
	public Object findByPrimaryKey(Serializable key) throws Exception {
		return ibaseDao.findByPrimaryKey(key);
	}

	public void insert(Object o) throws Exception {
		ibaseDao.insert(o);
	}

	public void saveOrUpdate(Object o) throws Exception {
		ibaseDao.saveOrUpdate(o);
	}

	public void update(Object o) throws Exception {
		ibaseDao.update(o);
	}

	
	public List findByProperty(String propertyName, Object value,
			PageUtil pageUtil) throws Exception {
		// TODO Auto-generated method stub
		return ibaseDao.findByProperty(propertyName, value, pageUtil);
	}

	
	public List findAll(PageUtil pageUtil) throws Exception {
		// TODO Auto-generated method stub
		return ibaseDao.findAll(pageUtil);
	}

	
	public List findAll() throws Exception {
		// TODO Auto-generated method stub
		return ibaseDao.findAll();
	}

	
}
